﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BKH.BLL;
using System.Threading;

namespace BKH
{
    public partial class frmLogin : Form
    {
        public frmLogin()
        {
            InitializeComponent();
        }

        private void btnDN_Click(object sender, EventArgs e)
        {

         
        
                
        }
         private void ShowForm2()
        {
            frmHome f = new frmHome();
            f.Activate();
            f.ShowDialog() ;
        }

         private void groupBox1_Enter(object sender, EventArgs e)
         {

         }

         private void groupBox1_Enter_1(object sender, EventArgs e)
         {

         }

         private void label1_Click(object sender, EventArgs e)
         {

         }

         private void btnLogin_Click(object sender, EventArgs e)
         {
             UserBUO obj = new UserBUO();

             if (obj.CheckUser(txtUserName.Text, txtPasspass.Text))
             {


                 Thread thread = new Thread(new ThreadStart(ShowForm2)); //Tạo luồng mới
                 thread.Start(); //Khởi chạy luồng
                 this.Close(); //đóng Form hiện tại. (Form1)


             }
             else
             {

                 lblMess.Text = "Sai password hay username !";
             }

         }




    }
}
